

import java.sql.Timestamp;
import java.util.*;
import java.util.Currency;

import net.sf.hibernate.*;
import com.gestion_stock.tables.*;
public class Test1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws HibernateException {
		Session session = HibernateUtil.currentSession();
		   
		Transaction tx = session.beginTransaction();
		
		
		
		Company c1 = new Company();
		c1.setLibelle("Ma Cie");
		session.save(c1);
		
		
		
		com.gestion_stock.tables.Currency cur1 = new com.gestion_stock.tables.Currency(new Integer(1));
		cur1.setCurrency("euros");
		session.save(cur1);
		
		Unit u1 = new Unit();
		u1.setId(new Integer (1));
		u1.setDescription("ahah");
		u1.setUnit("lol");		
		session.save(u1);
		
		Products p1 = new Products();
		p1.setLibelle("mon premier produit");
		p1.setDevise(cur1);
		p1.setPrix(new Integer(10));
		p1.setProduitCode("c52l3");
		p1.setUnite(u1);
		session.save(p1);
		
		
		Consumption co1 = new Consumption();
		co1.setCompany_code(new Integer(1));
		co1.setProduct_code(new Integer(1));
		co1.setDate(new Timestamp(1568));
		co1.setNb(new Integer(1));		
		session.save(co1);
		
		Users us1 = new Users();
		us1.setLogin("Aximilis");
		us1.setPassword("lolilol");
		us1.setCompany_code(new Integer(1));
		session.save(us1);
		
		
		Receipt rc1 = new Receipt();
		rc1.setCompany_code(new Integer(1));
		rc1.setDate(new Timestamp(1568));
		rc1.setNb(new Integer(2));
		rc1.setProduct_code(new Integer(1));
		session.save(rc1);
		
		System.out.println("libelle : " + c1.getLibelle());
		System.out.println("produit : " + p1.getLibelle());
		System.out.println("sortie : " + co1.getDate());
		System.out.println("user : " + us1.getLogin());
		System.out.println("reception : " + rc1.getDate());
		
		tx.commit();
	
		HibernateUtil.closeSession();
		 }
	}

